# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=nfpm
pkgver=2.41.0
pkgrel=0
pkgdesc="a simple apk, Deb and RPM packager without external dependencies"
url="https://nfpm.goreleaser.com/"
arch="all !riscv64"
license="MIT"
options="net" # net for go
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/goreleaser/nfpm/archive/v$pkgver.tar.gz"

# secfixes:
#   2.35.2-r0:
#     - CVE-2023-49568

export GOFLAGS="$GOFLAGS -modcacherw"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -ldflags "-X main.version=$pkgver" -v -o nfpm ./cmd/nfpm/main.go
}

check() {
	go test
}

package() {
	install -Dm0755 nfpm "$pkgdir"/usr/bin/nfpm
	install -Dm0644 LICENSE.md "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
8e93813dabe0662ed66314f6cd3adaf82892e9f4a59d0fb894931300ff29ac77b7a70dc460d96e74d31a5e39015ed9e93a0f3806e71c6b75aeef157aa8e8fac1  nfpm-2.41.0.tar.gz
"
